<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.common.core.js" ></script>
    <script src="../libraries/RGraph.common.key.js" ></script>
    <script src="../libraries/RGraph.common.effects.js" ></script>
    <script src="../libraries/RGraph.common.tooltips.js" ></script>
    <script src="../libraries/RGraph.common.dynamic.js" ></script>
    <script src="../libraries/RGraph.drawing.xaxis.js" ></script>
    <script src="../libraries/RGraph.hbar.js" ></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!--[if lt IE 9]><script src="../excanvas/excanvas.js"></script><![endif]-->
    
    <title>A Horizontal Bar chart example showing the XAxis drawing API object</title>
    
    
    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Horizontal Bar chart where the X axis is drawn using the drawing API" />
     
</head>
<body>

    <h1>A Horizontal Bar chart example showing the XAxis drawing API object</h1>


   <canvas id="cvs" width="600" height="400">[No canvas support]</canvas>

    <script>
        $(document).ready(function ()
        {
            var hbar = new RGraph.HBar({
                id: 'cvs',
                data: [[80,64],[1,2],[11,12],[3,12],[5,7]],
                options: {
                    gutter: {
                        left: 135,
                        top: 35
                    },
                    labels: ['Improved','Worsened', 'No change - \r\n peoples perceptions\r\nare generally positive','No change - \r\n peoples perceptions\r\nare generally negative',"Don't know"],
                    colors: ['#F68B23','#164366'],
                    xmax: 100,
                    background: {
                        grid: false
                    },
                    noxaxis: true,
                    noyaxis: true,
                    xlabels: false,
                    key: {
                        self: ['Non-disabled','Disabled'],
                        position: {
                            self: 'gutter',
                            gutter: {
                                boxed: false
                            },
                            y: 0
                        }
                    },
                    tooltips: ['A','B','C','D','E','F','G','H','I','J']
                }
            })
            .on('beforedraw', function (obj)
            {
                obj.context.fillStyle = '#eee';
                obj.context.fillRect(obj.gutterLeft, obj.gutterTop, obj.canvas.width - obj.gutterLeft - obj.gutterRight, obj.canvas.height - obj.gutterTop - obj.gutterBottom);
            })
            .on('draw', function (obj)
            {
                obj.context.strokeRect(obj.gutterLeft, obj.gutterTop, obj.canvas.width - obj.gutterLeft - obj.gutterRight, obj.canvas.height - obj.gutterTop - obj.gutterBottom);
            }).grow()




            var xaxis = new RGraph.Drawing.XAxis({
                id: 'cvs',
                y: 35,
                options: {
                    gutter: {
                        left: hbar.get('gutter.left')
                    },
                    max: 100,
                    align: 'top',
                    clearto: 'white'
                }
                }).draw()
        })
    </script>

    <p>
        <a href="./">&laquo; Back</a>
    </p>

</body>
</html>